package com.jeff.tianti.cms.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jeff.tianti.common.entity.BaseEntity;
import com.jeff.tianti.common.util.DateUtils;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "consult_compliance")//合规咨询表
@JsonIgnoreProperties(value={"areaPojo","hibernateLazyInitializer","handler","fieldHandler"})
public class ConsultCompliance extends BaseEntity {
    private static final long serialVersionUID = 4901831792715170256L;
    public static final String STATE_ONE = "0";
    public static final String STATE_TWO = "1";

    @Column(name = "uid")//用户id
    private String uid;
    @Column(name = "number")//编号
    private String number;
    @Column(name = "name")
    private String name;//广告名称
    @Column(name = "industry")
    private String industry;//广告行业
    @Column(name = "state")
    private String state;//状态:0->咨询中 1->已完成

    private Area areaPojo;//广告区域

    //    private String areaName;//区域名称
/*    @Column(name = "area")
    private String area;//区域id*/
    @Column(name = "text")
    private String text;//咨询内容
    @Column(name = "reply")//回复
    private String reply;
    @Column(name = "reply_date")//回复时间
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date replyDate;
    private String area;
    private String dateString;

    public String getDateString() {
        return DateUtils.dateToString(createDate);
    }

    public void setDateString(String dateString) {
        this.dateString = dateString;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    @Column(name = "area")
    public String getArea() {
        return areaPojo.getName();
    }

    public void setArea(String area) {
        this.area = area;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "area",updatable = false,insertable = false)
    public Area getAreaPojo() {
        return areaPojo;
    }

    public void setAreaPojo(Area areaPojo) {
        this.areaPojo = areaPojo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIndustry() {
        return industry;
    }

    public void setIndustry(String industry) {
        this.industry = industry;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }


    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getReply() {
        return reply;
    }

    public void setReply(String reply) {
        this.reply = reply;
    }

    public Date getReplyDate() {
        return replyDate;
    }

    public void setReplyDate(Date replyDate) {
        this.replyDate = replyDate;
    }
}
